---
title: ServiceMessage
summary: API reference for ServiceMessage.
status: draft
owner: SAIF Documentation
last_reviewed: 2026-08-21
library: SAIF.Application
reference_type: embedded
---

# ServiceMessage

`ServiceMessage` is an immutable value object representing one categorized message produced by a service-style manager. A [ServiceResponse](ServiceResponse.md) accumulates these in insertion order and filters them by `ServiceMessageType` for callers that distinguish business errors, warnings, informational notes, and environmental (infrastructure) failures.

## Purpose
- Carries a correlation key, display text, and severity/category classification as a single immutable triple, so callers can group and filter related messages by key or type.
- Backs `ServiceResponse.Errors` / `Warnings` / `InformationalMessages` / `EnvironmentalErrors`, which are LINQ filters over `ServiceResponse.Messages` keyed on this type's `Type` property ([BR-APP-009](../../business-rules.md#br-app-009-service-responses-succeed-until-declared-otherwise-exceptions-are-environmental)).

## Context
- Namespace: `SAIF.Application`
- Assembly/package: `SAIF.Application` (embedded, ProjectReference)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `New` | `Public Sub New(inKey As String, inMessage As String, inType As ServiceMessageType)` | Constructs an immutable key/text/type triple for one service message. |
| `Key` | `Public ReadOnly Property String` | Correlation key used to group related messages (e.g. an exception's type name, or a caller-supplied identifier). |
| `Message` | `Public ReadOnly Property String` | Display text shown to the caller or logged for the message. |
| `Type` | `Public ReadOnly Property As ServiceMessageType` | Severity/category classification used by `ServiceResponse`'s filtered collections. |
| `ToString` | `Public Overrides Function As String` | Returns `Message`, so a `ServiceMessage` can be used directly wherever a display string is expected. |

## Behavioral notes
- All properties are `ReadOnly`, so a `ServiceMessage` cannot be mutated after construction — the only way to change a message set is to add a new instance to a `ServiceResponse`.

## Constraints and usage notes
- Instances are created exclusively through `ServiceResponse.AddErrorMessage` / `AddWarningMessage` / `AddInformationMessage` / `AddEnvironmentMessage` / `ProcessException` in normal usage; there is no factory method on this type itself.*

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with `**` could not be confirmed; treat as unknown until verified.

## Sources
- `SAIF.Application/Service Based/ServiceMessage.vb`
- `SAIF.Application/Service Based/ServiceResponse.vb`
